{literal}
<script type="text/javascript">
    $(document).ready(function(){
    	
		var cod = "{/literal}{$pacote->id}{literal}";
    	
        $("#form_unidade").validate({
            rules: {
                nome: { required: true },
                descricao: { required: true }
            },
            messages: {
                nome: "Obrigatorio",
                descricao: { required: "Obrigatorio", maxlength: "O limite &eacute; de 200 caracteres."}
            },
            submitHandler: function(form) {
				jqAjaxForm(form, "div_mensagem");
			}
        });
        
        $("#valor").priceFormat();
        
        
        if (cod!="")
        {
	        {/literal}
	       	{foreach name=lista from=$servicos item=servico key=k}
	       		adicionarLinhaServico("div_pacote_servico", false, {$k+1}, '{$servico->servico_id}', '{$servico->int_quantidade_unidades}', '{$servico->flt_valor}', '{$_site.url}');
	       	{/foreach}
	       	{literal}
        }

        $("#btn_adicionar").click(function() {
        		adicionarLinhaServico("div_pacote_servico", true, 0, 0, "", "", '{/literal}{$_site.url}{literal}');
        });
        
    }); //fecha $(
    
</script>
{/literal}
<form id="form_unidade" name="form_unidade" method="post" action="{$_site.url}{$acao}">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="mvTituloFundo">
	  <tr>
		<td>
		{if $pacote->id > 0}Editar{else}Novo{/if} Pacote
		<input type="hidden" name="cod" value="{$pacote->id}"/>
		</td>
	  </tr>
	</table>
	<table width="100%" border="0" cellspacing="0" cellpadding="0">                
    <tr>
      <td class="contForm">
      
      <table width="100%" border="0" cellspacing="3" cellpadding="0">
          <tr>
            <td width="30%" valign="top" class="fundoTituloForm">Nome:</td>
            <td class="bordaFormResp"><input name="nome" type="text" class="formulario tamanhoForm" id="nome" value="{$pacote->vhr_nome}" maxlength="50"/></td>
          </tr>
          <tr>
            <td width="30%" valign="top" class="fundoTituloForm">Descri&ccedil;&atilde;o:</td>
            <td class="bordaFormResp"><textarea class="formulario tamanhoForm" name="descricao" id="descricao" maxlength="200">{$pacote->vhr_descricao}</textarea></td>
          </tr>
          <tr>
            <td class="bordaFormResp" colspan="4">
                <fieldset>
		        <legend><b>SERVI&Ccedil;OS</b></legend>
		        <table width="100%" border="0" cellspacing="0" cellpadding="0">                
                  <tr>
                  	 <td class="contForm">
                  	 	<table width="100%" border="0" cellspacing="3" cellpadding="0" id="div_pacote_servico">
                  	 		
                  	 	</table>
                  	 </td>
                  </tr>
                </table>
		        <input type="hidden" name="num_servicos" id="num_servicos" value="{$totalServicos}"/>
		        <input type="button" value="adicionar" id="btn_adicionar" name="btn_adicionar" class="botao"/><br/>
		        </fieldset>
			</td>
          </tr>
      </table>
      
      </td>
    </tr>
	<tr>
      <td class="paddingTop15 paddingBottom15" align="center"><!-- === Botões ( Salvar e Limpar ) === -->
          <span class="paddingRight15">
          	<input type="submit" value="Salvar" class="botao">
          </span>
        <span class="paddingRight15">
        <input name="limpar" type="reset" id="Limpar" value="Limpar" class="botao" />
        </span>
        <input type="button" value="Cancelar" onclick="cancelar(); return false;" class="botao">
          <!-- Final === Botões ( Salvar e Limpar ) === -->                      
      </td>
    </tr>
  </table>	
</form>
